<template>
    <view class="">
    资讯界面
	<tabbar ref="tab" :activeIndex="activeTab" @popLogin="popLogin"></tabbar>
	<service-agreeement ref="agreementPopup" @confirm="handleAgreementConfirm" />
    </view>
</template>

<script setup>
import { ref,onMounted} from 'vue'
import { USER_TYPES,userApi } from '@/service/api.js'
import {onShow} from '@dcloudio/uni-app'
import { userStore } from '@/utils/userStore.js' 
import { RouterMethods } from '@/utils/router'

const activeTab = ref(null)
const popLogin = () => { 
 agreementPopup.value.open()
}
const selectedType = ref('')
onShow(() => {
	console.log('资讯界面 show')
	selectedType.value = userStore.getType()
	if (selectedType.value == USER_TYPES.CLIENT || 
	selectedType.value == USER_TYPES.SUPPLIER ) {
		activeTab.value = 1
	} else {
		activeTab.value = 2
	}	
})
const agreementPopup = ref(null)

const handleAgreementConfirm = async()=>{
	setTimeout(()=>{
		RouterMethods.toHome()
	},1000)
}

onMounted(() => {
	uni.hideTabBar()
	console.log('pageB onMounted')
})

</script>

<style lang="scss" scoped>

</style>
